﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace Incendios0_1.tools
{
    class LoadState : INotifyPropertyChanged
    {
        private bool isBusy;
        public bool IsBusy
        {
            get
            {
                return isBusy;
            }

            set
            {
                if (value != isBusy)
                {
                    isBusy = value;
                    Notify("isBusy");
                }
            }
        }
        private string currentOperation;
        public string CurrentOperation
        {
            get
            {
                return currentOperation;
            }
            set
            {
                if (value != currentOperation)
                {
                    currentOperation = value;
                    Notify("currentOperation");
                }
            }
        }
        private string operationMessage;
        public string OperationMessage
        {
            get
            {
                return operationMessage;
            }
            set
            {
                if (value != operationMessage)
                {
                    operationMessage = value;
                    Notify("operationMessage");
                }
            }
        }
        private int proggresion;
        public int Proggresion
        {
            get
            {
                return proggresion;
            }
            set
            {
                if (value != proggresion)
                {
                    proggresion = value;
                    Notify("proggresion");
                }
            }
        }

        public LoadState(bool isBusy, int progression)
        {
            this.isBusy = isBusy;
            this.proggresion = progression;
        }

        public event PropertyChangedEventHandler PropertyChanged;
        protected void Notify(string propertyName)
        {
            if (this.PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
